home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / croutes.zip / CURDOWN.C < prev    next >
Text File  |  1984-04-05  |  1KB  |  47 lines

  1. /*                        *** curdown.c ***                          */
  2. /*                                                                   */
  3. /* IBM - PC microsoft "C"                                            */
  4. /*                                                                   */
  5. /* Function to move the cursor down y relative lines.                */
  6. /*                                                                   */
  7. /* Written by L. Cuthbertson, March 1984.                            */
  8. /*                                                                   */
  9. /*********************************************************************/
  10. /*                                                                   */
  11.  
  12. #define NULL    '\000'
  13. #define POUND    '#'
  14.  
  15. curdown(y)
  16. int y;
  17. {
  18.     extern char CUD[];
  19.     char yrel[3],command[20];
  20.     int i,inpos,outpos;
  21.  
  22.     /* initialize screen controls */
  23.     scrinit();
  24.  
  25.     /* convert integer relative motion into string */
  26.     sprintf(yrel,"%d",y);
  27.  
  28.     /* build command line */
  29.     inpos = 0;    /* position within control string */
  30.     outpos = 0;    /* position within command string */
  31.  
  32.     while (CUD[inpos] != POUND)
  33.         command[outpos++] = CUD[inpos++];
  34.  
  35.     for (i=0;yrel[i] != NULL;i++)
  36.         command[outpos++] = yrel[i];
  37.  
  38.     inpos++;
  39.     while (CUD[inpos] != NULL)
  40.         command[outpos++] = CUD[inpos++];
  41.  
  42.     command[outpos] = NULL;
  43.  
  44.     /* write command to screen */
  45.     writes(command);
  46. }
  47.